# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=falkon
pkgver=3.1.0
pkgrel=15
pkgdesc="Cross-platform QtWebEngine browser"
arch=(x86_64)
url="https://www.falkon.org/"
license=(GPL3)
depends=(qt5-webengine qt5-x11extras qt5-svg)
makedepends=(extra-cmake-modules qt5-tools kio purpose libgnome-keyring pyside2 shiboken2)
optdepends=('kio: KDE integration' 'purpose: KDE integration' 'libgnome-keyring: gnome keyring integration'
            'pyside2: Python plugins')
replaces=(qupzilla)
source=(https://download.kde.org/stable/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz{,.sig}
        falkon-pyside-5.12.2.patch::"https://invent.kde.org/network/falkon/-/commit/479933e0.patch"
        falkon-qt-5.14.patch::"https://invent.kde.org/network/falkon/-/commit/bbde5c69.patch"
        falkon-qt-5.15.patch::"https://invent.kde.org/network/falkon/-/commit/2ca83509.patch"
        falkon-shiboken-5.15.2.patch)
sha256sums=('ce743cd80c0e2d525a784e29c9b487f73480119b0567f9ce8ef1f44cca527587'
            'SKIP'
            '6ca8fe7339229eb36fe8124e0071237f6dff06de38043a23a325a0fd0361e4e0'
            'ab7a8a1952e7efb5c3e9a3983d049132a7b56b29bd0007c7a0a8506189d86ec8'
            '24c2ca89295367a7e64c2c62ebd6400110472f51f2bc7937ae0e5a80b2bd5ad4'
            '72b5d1dec32a486a97a712a173f67b466b93f7d578732dd47de247d66d4c0f81')
validpgpkeys=(3CB7B8416EF6778B409FDC43EBC3FC294452C6D8) # David Rosca <nowrep@gmail.com>

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../falkon-pyside-5.12.2.patch # Fix build with PySide 5.12.2
  patch -p1 -i ../falkon-qt-5.14.patch # Fix build with Qt 5.14
  patch -p1 -i ../falkon-qt-5.15.patch # Fix build with Qt 5.15
  patch -p1 -i ../falkon-shiboken-5.15.2.patch # Fix build with shiboken 5.15.2
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DBUILD_TESTING=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
